var cLeft = 200
var cTop = 260

var cr = 150//圆半径

var arrDivs = []//页面的div集合
for (var i = 0; i < 10; i++) {
    var div = document.createElement('div')
    div.style.width = '50px'
    div.style.height = '50px'
    div.style.backgroundColor = 'red'
    div.style.position = 'absolute'


    //随机计算div的位置
    div.style.left = cLeft + cr * Math.cos(i * Math.PI / 5) + 'px'
    div.style.top = cTop + cr * Math.sin(i * Math.PI / 5) + 'px'
    div.dataset['radius'] = i * Math.PI / 5
    arrDivs.push(div)
    document.body.appendChild(div)
}
function doRound(item){
    arrDivs.forEach(function(item){
        var r = 1*item.dataset.radius+1*Math.PI/180
        item.dataset.radius = r
        item.style.left = cLeft + cr*Math.cos(r) + 'px'
        item.style.top = cTop + cr*Math.sin(r) + 'px'
    })
    requestAnimationFrame(doRound)
}
doRound()

